@echo off

set file=open

:	Delete old files

	if exist *.bak del *.bak
	if exist gp*.log del gp*.log

:	Run Tablo

tablo -sti %file%.sti > %file%-tab.log
if errorlevel 1 goto error

:	Run GEMSim

gemsim -cmf %file%.cmf > %file%-run.log
if errorlevel 1 goto error

echo.
echo	Successful completion
echo.
if exist %file%.dis tabmate %file%.dis
if exist %file%.sl4 viewsol %file%.sl4
goto end

:error
echo.
echo	ERROR : check log file
echo.
pause
tabmate %file%-tab.log
if exist %file%-run.log tabmate %file%-run.log

:end